<template>
	<view>
		<view class="line">
			<up-tabs :list='data.tabs' lineColor='transparent' :scrollable="false"
				activeStyle='font-weight: bold;color:rgb(238,182,99)'></up-tabs>
		</view>
		<view class="pb20 mt40" v-if='data.list.length>0'>
			<view class="list d-b-c f-w pl30 pr30">
				<view class="item mb10" v-for="(item,index) in data.list" :key="index"
					@click="store.commit('jump',`/pages/detail/detail?id=${item.id}`)">
					<view class="img d-c-c">
						<image src="@/static/image/icon_index3.png" mode="widthFix"></image>
						<view class="tags d-s-c">
							<view class="mr10" v-for="(e,i) in item.tags" :key="i">
								<up-tag size="mini" bgColor="#fff" borderColor="transparent" color="#999"
									:text="e"></up-tag>
							</view>
						</view>
					</view>
					<view class="bg-white p20">
						<view class="name f28">{{item.name}}</view>
						<view class="subs f22 mt10">{{item.sub}}</view>
					</view>
				</view>
			</view>
			<up-loadmore :status="data.status" line marginTop="20"></up-loadmore>
		</view>
		<up-empty marginTop="5vh" mode="list" v-else></up-empty>
	</view>
</template>

<script setup>
	import { reactive } from 'vue'
	import { onLoad } from "@dcloudio/uni-app";
	import { useStore } from "vuex"
	const store = useStore()
	const data = reactive({
		tabs: [{
			name: "综合"
		}, {
			name: "新品"
		}, {
			name: "销量"
		}, {
			name: "价格"
		}],
		status: "loadmore",
		list: [{
			name: "马可波罗全抛釉砖",
			sub: '90PW G55',
			tags: ['多规格', '多颜色'],
			img: '@/static/image/icon3.png'
		}, {
			name: "马可波罗全抛釉砖",
			sub: '90PW G55',
			tags: ['多规格', '多颜色'],
			img: '@/static/image/icon3.png'
		}, {
			name: "马可波罗全抛釉砖",
			sub: '90PW G55',
			tags: ['多规格', '多颜色'],
			img: '@/static/image/icon3.png'
		}, {
			name: "马可波罗全抛釉砖",
			sub: '90PW G55',
			tags: ['多规格', '多颜色'],
			img: '@/static/image/icon3.png'
		}, {
			name: "马可波罗全抛釉砖",
			sub: '90PW G55',
			tags: ['多规格', '多颜色'],
			img: '@/static/image/icon3.png'
		}]
	})
	onLoad((option) => {
		data.current = option.id
	})
</script>

<style scoped lang="scss">
	.list {
		.item {
			border: 1px solid #ccc;
			width: calc(50% - 5rpx);

			.img {
				height: 200rpx;
				position: relative;

				image {
					width: 100rpx;
				}

				.tags {
					position: absolute;
					bottom: 20rpx;
					left: 10rpx;
				}
			}

			.subs {
				color: #FBE5CB;
			}
		}
	}
</style>